#pragma once
#include <QQuickFramebufferObject>
#include <QOpenGLFramebufferObject>
#include "logorenderer.h"

class LogoInFboRenderer : public QQuickFramebufferObject::Renderer {
public:
    LogoInFboRenderer() {
        logo.initialize();
    }

    void render() override {
        logo.render();
        /**
         * update(): Call this function when the FBO should be rendered again.
         * This function can be called from render() to force the FBO to be rendered again before the next frame.
         */
        update();
    }

    QOpenGLFramebufferObject* createFramebufferObject(const QSize &size) override {
        QOpenGLFramebufferObjectFormat format;
        format.setAttachment(QOpenGLFramebufferObject::Depth);
        format.setSamples(8);// not embed device
        return new QOpenGLFramebufferObject(size, format);
    }

    LogoRenderer logo;
};

class FboInSGRenderer : public QQuickFramebufferObject {
    Q_OBJECT
public:
    QQuickFramebufferObject::Renderer* createRenderer() const {
        return new LogoInFboRenderer();
    }
};

